// custom-tab-bar/index.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {},
  /**
   * 组件的初始数据
   */
  data: {
    show: false,
    selected: 0,
    "color": "#37455C",
    "selectedColor": "#37455C",
    "list": [{
        "pagePath": "/pages/index/index",
        "text": "主页",
        "iconPath": "/img/navIcon/home1.png",
        "selectedIconPath": "/img/navIcon/home2.png"
      },
      {
        "pagePath": "/pages/tongxun/tongxun",
        "text": "电话簿",
        "iconPath": "/img/navIcon/tongxun1.png",
        "selectedIconPath": "/img/navIcon/tongxun2.png"
      },
      {
        "pagePath": "/pages/geren/geren",
        "text": "我的",
        "iconPath": "/img/navIcon/geren1.png",
        "selectedIconPath": "/img/navIcon/geren2.png"
      }
    ]
  },
  /**
   * 组件的方法列表
   */
  methods: {
    // 标签切换
    switchTab(e) {
      getApp().globalData.activeIdx = e.detail
      const data = e.currentTarget.dataset;
      const url = data.path;
      this.setData({
        selected: data.index
      })
      wx.switchTab({
        url
      })
    }
  }
})